#pragma once
#include <ManagerBase.h>
#include <GUIEventDispatcher.h>
#include <Dialog.h>
#include <ITraverse.h>

namespace grflib
{
	namespace engine
	{
		namespace aux
		{
			////////////////////////////////////////
			//GUI panel manager
			class CGUIManager : public grflib::engine::core::_CManagerBase<grflib::engine::aux::CDialog>
			{
			public:
				CGUIManager() : m_addOnly(0) {}
				virtual ~CGUIManager() {}

				HRESULT OnCreateDevice(ID3D10Device *pd3dDevice);
				HRESULT OnResize(ID3D10Device *pd3dDevice, IDXGISwapChain *pSwapChain, const DXGI_SURFACE_DESC* pBufferSurfaceDesc);

				void Release(void) { m_dialogResourceManager.OnD3D10ReleasingSwapChain(); }
				void OnDestroy(void) { m_dialogResourceManager.OnD3D10DestroyDevice(); }
				bool MsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

				bool AddObj(const std::string &name, boost::shared_ptr<CDialog> &pObj); //overwrite base function

				int TranslateId(char *szId); //engine scope universal control id!
				
				typedef boost::unordered_map<std::string, int> id_map_type;

			protected:
				CDXUTDialogResourceManager m_dialogResourceManager;
				id_map_type m_ctrlIdMap;
				int m_addOnly;
			};

		} //namespace aux
	} //namespace engine
} //namespace grflib